# 创建一个浏览器对象
from selenium import webdriver
from selenium.webdriver.chrome.service import Service
from webdriver_manager.chrome import ChromeDriverManager


class Driver:
    driver = None

    def __init__(self):
        options = webdriver.ChromeOptions()
        self.driver = webdriver.Chrome(
            service=Service(ChromeDriverManager().install()),
            options=options
        )


# 正确的实例化方式（在类定义外部）
if __name__ == "__main__":
    blog_driver = Driver()  # 创建Driver实例
